import {
  ADD_ONE,
  FETCH_REQUEST,
  FETCH_FAILED,
  FETCH_SUCCESS,
  USER_LOGIN_SUCCESS,
  USER_LOGIN_FAILED,
  USER_LOGIN_REQUEST,
  USER_FORGETPASSWORD_REQUEST,
  USER_FORGETPASSWORD_SUCCESS,
  USER_FORGETPASSWORD_FAILED
} from "../constants/actionTypes";

export const add = payload => {
  return {
    type: ADD_ONE,
    payload
  };
};

export const fetchRequest = payload => {
  // 开始
  return { type: FETCH_REQUEST, payload };
};

export const fetchFailed = () => {
  // 失败
  return { type: FETCH_FAILED };
};

export const fetchSuccess = () => {
  // 成功
  return { type: FETCH_SUCCESS };
};

/*登录*/
export const postLoginRequest = payload => {
  return { type: USER_LOGIN_REQUEST, payload };
};

export const postLoginSuccess = payload => {
  return { type: USER_LOGIN_SUCCESS, payload };
};

export const postLoginFailed = payload => {
  return { type: USER_LOGIN_FAILED, payload };
};

/*忘记密码*/
export const forgetPasswordRequest = payload => {
  return { type: USER_FORGETPASSWORD_REQUEST, payload };
};

export const forgetPasswordSuccess = payload => {
  return { type: USER_FORGETPASSWORD_SUCCESS, payload };
};

export const forgetPasswordFailed = payload => {
  return { type: USER_FORGETPASSWORD_FAILED, payload };
};
